<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>控制台主页一</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/admin/style/admin.css" media="all">
  <style>

    .layui-carousel>.chome-fix>*{
      display: initial;
    }
    .time-on {
      color: #009688;
    }

    iframe{ border: 0px; width: 100%; height: 100%;}


  </style>

</head>
<body>
  
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md8">
        <div class="layui-row layui-col-space15">
          <div class="layui-col-md6">
            <div class="layui-card">
              <div class="layui-card-header">快捷方式</div>
              <div class="layui-card-body">
                
                <div class="layui-carousel layadmin-carousel layadmin-shortcut" >
                  <div carousel-item class="chome-fix">
                    <ul class="layui-row layui-col-space10">
                      <li class="layui-col-xs3">
                        <a lay-href="{:url('Ad/index')}">
                          <i class="layui-icon layui-icon-chart-screen"></i>
                          <cite>广告</cite>
                        </a>
                      </li>
                      <li class="layui-col-xs3">
                        <a lay-href="{:url('Link/index')}">
                          <i class="layui-icon layui-icon-link"></i>
                          <cite>友链</cite>
                        </a>
                      </li>
                      <li class="layui-col-xs3">
                        <a lay-href="{:url('Feedback/index')}">
                          <i class="layui-icon layui-icon-reply-fill"></i>
                          <cite>留言</cite>
                        </a>
                      </li>
                      <li class="layui-col-xs3">
                        <a lay-href="{:url('Fragment/index')}">
                          <i class="layui-icon layui-icon-top"></i>
                          <cite>碎片</cite>
                        </a>
                      </li>                      
                      <li class="layui-col-xs3">
                        <a href="{:url('Node/icon')}" target="_blank">
                          <i class="layui-icon layui-icon-face-smile"></i>
                          <cite>图标</cite>
                        </a>
                      </li>
                      <li class="layui-col-xs3">
                        <a lay-href="{:url('Cat/index')}">
                          <i class="layui-icon layui-icon-template-1"></i>
                          <cite>栏目</cite>
                        </a>
                      </li>
                      <li class="layui-col-xs3">
                        <a lay-href="{:url('User/index')}">
                          <i class="layui-icon layui-icon-user"></i>
                          <cite>用户</cite>
                        </a>
                      </li>
                      <li class="layui-col-xs3">
                        <a lay-href="{:url('Config/index')}">
                          <i class="layui-icon layui-icon-set"></i>
                          <cite>设置</cite>
                        </a>
                      </li>
                    </ul>

                  </div>
                </div>
                
              </div>
            </div>
          </div>
          <div class="layui-col-md6">
            <div class="layui-card">
              <div class="layui-card-header">数据统计</div>
              <div class="layui-card-body">

                <div class="layui-carousel layadmin-carousel layadmin-backlog">
                  <div carousel-item class="chome-fix">
                    <ul class="layui-row layui-col-space10">
                      <li class="layui-col-xs6">
                        <a class="layadmin-backlog-body">
                          <h3>信息数量</h3>
                          <p><cite>{$infoNum}</cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs6">
                        <a class="layadmin-backlog-body">
                          <h3>待审核</h3>
                          <p><cite>{$readyCheckNum}</cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs6">
                        <a  class="layadmin-backlog-body">
                          <h3>草稿箱</h3>
                          <p><cite>{$draftNum}</cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs6">
                        <a  class="layadmin-backlog-body">
                          <h3>附件数</h3>
                          <p><cite>{$fileNum}</cite></p>
                        </a>
                      </li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>
          </div>

        </div>
      </div>
      
      <div class="layui-col-md4">
        <div class="layui-card">
          <div class="layui-card-header">版本信息</div>


          <div class="layui-card-body layui-text">

            <div class="layui-carousel layadmin-carousel" data-autoplay="true" data-anim="fade" lay-filter="news">
              <div carousel-item>
                <div>
                  <table class="layui-table">
                    <colgroup>
                      <col width="100">
                      <col>
                    </colgroup>
                    <tbody>
                    <tr>
                      <td>当前版本</td>
                      <td>
                        JijinCMS{:config("app.version")}
                      </td>
                    </tr>
                    <tr>
                      <td>操作系统</td>
                      <td>
                        ThinkPHP6
                      </td>
                    </tr>
                    <tr>
                      <td>MySQL</td>
                      <td>零门槛 / 响应式 / 清爽 / 极简</td>
                    </tr>
                    <tr>
                      <td>技术支持</td>
                      <td style="padding-bottom: 0;">
                        <div class="layui-btn-container">
                          <a href="http://www.jijincms.com" target="_blank" class="layui-btn layui-btn-danger">JijinCMS</a>
                        </div>
                      </td>
                    </tr>
                    </tbody>
                  </table>

                </div>
                <div>
                  <iframe src="http://jijincms.ali5.jijinweb.com/sub_news/index.html"></iframe>
                </div>
              </div>
            </div>



          </div>
        </div>
      </div>
      
    </div>
    <div class="layui-row layui-col-space15">
      <div class="layui-card">
        <div class="layui-card-header" style="display: flex;justify-content: flex-start" >
<!--          <span id="fangwen">访问量(今天)</span>-->
          <div class="layui-btn-group layuiadmin-btn-group " style="left: 15px;">
            <a href="javascript:;" class="layui-btn layui-btn-primary layui-btn-xs time-on" id="today"
               onclick='get_tongji_data(this,"today","今天")'>今天</a>
            <a href="javascript:;" class="layui-btn layui-btn-primary layui-btn-xs"
               onclick='get_tongji_data(this,"yesterday","昨天")'>昨天</a>
            <a href="javascript:;" class="layui-btn layui-btn-primary layui-btn-xs"
               onclick='get_tongji_data(this,"week","最近7天")'>最近7天</a>
            <a href="javascript:;" class="layui-btn layui-btn-primary layui-btn-xs"
               onclick='get_tongji_data(this,"month","最近30天")'>最近30天</a>
            <a href="javascript:;" class="layui-btn layui-btn-primary layui-btn-xs"
               onclick='get_tongji_data(this,"halfyear","最近半年")'>最近半年</a>
            <a href="javascript:;" class="layui-btn layui-btn-primary layui-btn-xs"
               onclick='get_tongji_data(this,"year","最近一年")'>最近一年</a>
          </div>
        </div>
        <div class="layui-card-body">
          <div class="layui-row">
            <div class="layui-col-sm8" id="main" style="height:400px;">

            </div>
            <div class="layui-col-sm4" id="main2" style="height:400px;">

            </div>
          </div>
        </div>
      </div>

    </div>

    <div class="layui-row layui-col-space15" style="margin-top: 20px;">
      <div class="layui-col-md6">
        <div class="layui-card">
          <div class="layui-tab layui-tab-brief layadmin-latestData">
            <ul class="layui-tab-title">
              <li class="layui-this" style="display: flex;justify-content: space-between">最近留言 <a lay-href="{:url('Feedback/index')}" style="color: #009688">More</a></li>
             
            </ul>

            <div class="layui-tab-content">
              <table class="layui-table">
                <thead>
                <tr>
                  <th width="3%">ID</th>
                  <th width="10%">分类</th>
                  <th width="10%">姓名</th>
                  <th width="15%">手机</th>
                  <th width="10%">时间</th>
                </tr>
                </thead>
                <tbody>
                {foreach $recent_msg as $key=>$v}
                <tr>
                  <td style="text-align: center;">{$v.id}</td>
                  <td class="center tab-title">[{$v.cat.name}]</td>
                  <td class="center">{$v.name}
                    {if $v.is_read==1}
                    <span class="layui-badge layui-bg-gray">已读</span>
                    {else /}
                    <span class="layui-badge layui-bg-red">未读</span>
                    {/if}
                  </td>
                  <td class="center">{$v.mobile}</td>
                  <td class="center">{$v.addtime|date="Y-m-d H:i:s"}</td>

                </tr>

                {/foreach}
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>

      <div class="layui-col-md6">
        <div class="layui-card">
          <div class="layui-tab layui-tab-brief layadmin-latestData">
            <ul class="layui-tab-title">
              <li class="layui-this" style="display: flex;justify-content: space-between">登录日志 <a lay-href="{:url('UserLoginLog/index')}" style="color: #009688">More</a></li>
            </ul>
            <div class="layui-tab-content">
              <table class="layui-table">
                <colgroup>
                  <col width="150">
                  <col width="150">
                  <col width="200">
                  <col>
                </colgroup>
                <thead>
                <tr>
                  <th width="10%">ID</th>
                  <th>用户名</th>
                  <th>登录时间</th>
                  <th>登录IP</th>
                  <th>状态</th>
                </tr>
                </thead>
                <tbody>
                {foreach $login_log as $key=>$v}
                <tr>
                  <td style="text-align: center;">{$v.id}</td>
                  <td class="center tab-title">{$v.username}</td>
                  <td class="center"><?=date("Y-m-d H:i:s",$v['addtime'])?></td>
                  <td class="center">{$v['ip']}</td>
                  <td class="center"><span class="layui-badge {$v['status']?'layui-bg-green':''}">{$v.note}</span></td>

                </tr>

                {/foreach}
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>

    </div>

  </div>

  <script src="/static/admin/layui/layui.all.js"></script>
  <script src="/static/js/jquery.min.js"></script>
  <script src="/static/js/globals.js"></script>
  <script src="/static/echarts/echarts.min.js"></script>
  <script src="/static/admin/lib/extend/echartsTheme.js"></script>

  <script>

  layui.config({
    base: '/static/admin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'console'],function (){
  });
  </script>


  <script>
    $(function () {
      get_tongji_data(today,"today",'今天');
    })
    var data;

    function get_tongji_data(e,type, desc) {
      $('.time-on').removeClass('time-on');
      $(e).addClass('time-on');
      $.get("{:url('index/getTongji')}?type=" + type, function (result) {
        data = result.msg;
        console.log(result)
        tongji();
        $("#fangwen").text('访问量（' + desc +'）');
      }, "json");
    }

      function tongji(){
      // 绘制图表。
      echarts.init(document.getElementById('main')).setOption({
        title : {
          text: '访客数据',
          subtext: '',
          x:'center'
        },
        tooltip : {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            label: {
              backgroundColor: '#6a7985'
            }
          }
        },
        legend: {
          top:'10%',
          data:['IP','PV']
        },
        grid: {
          top:'20%',
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis : [
          {
            type : 'category',
            data : data.bar_name,
          }
        ],
        yAxis : [
          {
            type : 'value'
          }
        ],
        series : [
          {
            name:'IP',
            type:'line',
            data:data.bar_ip_total
          },
          {
            name:'PV',
            type:'line',
            data:data.bar_pv_total
          }
        ]
      });
      // 绘制图表。
      echarts.init(document.getElementById('main2')).setOption({
        title : {
          text: '访问来源',
          subtext: '',
          x:'center'
        },
        tooltip: {
          trigger: 'item',
          formatter: "{a} <br/>{b}: {c} ({d}%)"
        },
        legend: {
          top:'10%',
          orient: 'horizontal',
          x: 'center',
          data:data.pie_name
        },
        series: [
          {
            name:'访问来源',
            type:'pie',
            selectedMode: 'single',
            radius: [0, '30%'],
            center: ['60%', '60%'],
            label: {
              normal: {
                position: 'inner',
                top:'50px',
              }
            },
            labelLine: {
              normal: {
                show: false
              }
            },
            data:data.pie_data1
          },
          {
            name:'访问来源',
            type:'pie',
            center: ['60%', '60%'],
            radius: ['40%', '55%'],
            data:data.pie_data2
          }
        ]
      });
    }

  </script>
</body>
</html>

